package com.zhengtoon.mctoon.conv.controller;

import com.qitoon.framework.core.exception.BusinessException;
import com.zhengtoon.mctoon.conv.exception.ConvPhotoExceptionCode;
import com.zhengtoon.mctoon.conv.utils.AppConstant;
import com.zhengtoon.mctoon.conv.utils.SessionInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2017/4/13.
 */
public class BaseController {

    private static final Logger log = LoggerFactory.getLogger(BaseController.class);

    protected SessionInfo getSessionInfo(HttpServletRequest request) {
        try {
            return (SessionInfo) request.getAttribute(AppConstant.REQ_SESSION_ATTR_KEY);
        } catch (Exception e) {
            log.error("获取session信息失败", e);
            throw new BusinessException(ConvPhotoExceptionCode.SESSION_IS_FAIL);
        }

    }

}
